<%--
	fileName      : /prodmgmt/WebContent/sso_client/SSO_CLIENT_MAIN.jsp
	author        : lenovo
	createDate    : 2016-03-29  10:14:37
	lastModifier  : lenovo
	lastModifyDate: 2016-03-29  10:14:37
	description   : 应用服务 根据用户权限展现菜单
--%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<title>TW</title>
		<link href="<%=path %>/sso_client/menu/css/preview.css" type="text/css" rel="stylesheet"/>
		<link href="<%=path %>/sso_client/menu/css/modern-menu.css" type="text/css" rel="stylesheet"/>
		<script type="text/javascript" src="<%=path %>/js/jquery/jquery.js"></script>
		<script type="text/javascript" src="<%=path %>/js/jquery/jquery-migrate.js"></script>
		<script src="<%=path %>/sso_client/menu/js/jquery.transit.min.js" type="text/javascript"></script>
		<script src="<%=path %>/sso_client/menu/js/jquery.modern-menu.min.js" type="text/javascript"></script>
		<script src="<%=path %>/sso_client/menu/js/jquery.layout-latest.js" type="text/javascript"></script>
		<script type='text/javascript'>
			var switchflag='<ctp:out name="switchflag"/>';
			if(switchflag == '1'){
				var itemIdx="<%=request.getParameter("itemIdx") %>";
				window.location.href='<ctp:url href="ssohomepage.flowc" flowActionName="SWITCHPAGE" />'+'&itemIdx='+encodeURIComponent(itemIdx);
			}
			var dataStr='<ctp:out name="menus"/>';
			var sessionId='<ctp:out name="sessCtx.dse_sessionId"/>';
			var sheet='<ctp:url href="getlogonmenu.flowc" flowActionName="introduction" />';
			//alert(sessionId);
			function initMenu(){
				if(dataStr){
					var data=eval(dataStr);
					var rootObj=jQuery('<ul class="modern-menu theme2"></ul>');
					rootObj.append('<li><a href="javascript:gotox(\''+sheet+'\',\'首页\');"><span>首页</span></a></li>');
					var di;
					for(var i=0,n=data.length;i<n;i++){
						di=data[i];//alert(typeof di.pid);
						if(di.level != "1"){ 
							if(di.level == "2" && di.childCount == "0"){
								rootObj.append('<li><a href="javascript:gotox(\''+'<%=path %>/'+di.menuUrl+((di.menuUrl.indexOf("?")==-1)?"?":"\&")+"dse_sessionId="+sessionId+'\',\''+di.menuName+'\');"><span>'+di.menuName+'</span></a></li>'); 
							}else if(di.level == "2" && di.childCount != "0"){
								rootObj.append('<li><a href="javascript:void(0);"><span>'+di.menuName+'</span></a><ul id="ul_'+di.id+'"></ul></li>');
							}else if(di.childCount == "0"){
								rootObj.find("#ul_"+di.pid).append('<li><a href="javascript:gotox(\''+'<%=path %>/'+di.menuUrl+((di.menuUrl.indexOf("?")==-1)?"?":"\&")+"dse_sessionId="+sessionId+'\',\''+di.menuName+'\');"><span>'+di.menuName+'</span></a></li>');
							}else{
								rootObj.find("#ul_"+di.pid).append('<li><a href="javascript:void(0);"><span>'+di.menuName+'</span></a><ul id="ul_'+di.id+'"></ul></li>');
							}
						}
					}
					//alert(rootObj[0].outerHTML);
					jQuery("#diy").append(rootObj);
					//jQuery("#diy").text(rootObj[0].outerHTML);
					//var rootText=rootObj[0].outerHTML;
					//rootText=rootText.replace(/&amp;/g,'&');
					//jQuery("#divtext").text(rootText);
					//jQuery("#diy").append(rootText);
				}
			}
			var titleText="";
			var pWin;
			//初始化函数
			function init(){
				/* if (!!window.ActiveXObject || "ActiveXObject" in window) {
					//alert("ie");
					var tit=window.parent.document.getElementById("main_header");
					var jQt=jQuery(tit);
					pWin=jQt.find(".breadcrumb_nav");
					titleText=pWin.text();
				}else{
					//alert("not ie");
				} */
			}
			function gotox(url,titleSub){
				if(url){
					/* if(pWin){
						pWin.text(titleText+"--->"+titleSub);
					} */
					document.getElementById("frame_main").src=url;
				}
			}
			function controlH(){
				var x3=document.documentElement.clientHeight;
				jQuery("#frame_main").css({height:x3});
			}
			jQuery(function(){
				 controlH();
				 //当浏览器窗口大小改变时，设置显示内容的高度  
			        window.onresize=function(){  
			          controlH();  
			          rH();
			        };
			});
			$(document).ready(function () {   
			        $('body').layout({  
			            north: {  
			                    size:40,  
			                    spacing_open:0,  
			                    closable:false,  
			                    resizable:false  
			            },  
			            center: {  
			                    size:20,      
			                    spacing_open:0  
			            } 
			        });  
		        
		        /* var divH=jQuery("#diy").css("height");//40 40
		        var bodyH=jQuery("body").css("height");//836 791
		        var iframeH=jQuery("#frame_main").css("height");//791 791
		        var bh=parseInt(divH.replace("px"))+parseInt(iframeH.replace("px"));
		        alert(divH+"..."+bodyH+"..."+iframeH+"..."+(bh)+"px");
		        jQuery("body").css("height",bh+"px");
		        alert(jQuery("body").css("height")); */
		        //jQuery(".ui-layout-center").css("position","static");
		        rH();
			});
			function rH(){
				var iframeH=jQuery("#frame_main").css("height");
		        var nH=(parseInt(iframeH.replace("px"))-37)+"px";
			    jQuery("#frame_main").attr("style","height:"+nH);
			}
			 //alert(jQuery("#frame_main").attr("style"));
        </script>
        <style type="text/css">
        	body{
        		margin-top:0;
        		height:100%;
        	}
        	.modern-menu{
        		width:100%;
        	}
			.theme2 .mm-over {
			    background-color: #cc0000;
			    color: #fafafa;
			} 
			#main_centerx{
				height:100%;
			}
        </style>
	</head>
	<body>
		<div class="ui-layout-center">
			<div id="diy">
			
			</div>
			<div>
				<iframe id="frame_main" marginheight="0" marginwidth="0" frameborder="0" width="100%" scrolling="auto"  src="<ctp:url href='sso_blank.flowc' flowActionName='SSO_BLANK' />">
	            </iframe>
	        </div>
        </div>
		<script type="text/javascript">
			//init();
			initMenu();
			$(".modern-menu").modernMenu();
			//取消背景样式
			jQuery("html").css({ "background-color": "transparent", "background-image": "none" });
			
			gotox(sheet,'首页');
		</script>
	</body>
</html>

<%--
	date        :
	modifyReason:
--%>